// We require the Hardhat Runtime Environment explicitly here. This is optional
// but useful for running the script in a standalone fashion through `node <script>`.
//
// You can also run a script with `npx hardhat run <script>`. If you do that, Hardhat
// will compile your contracts, add the Hardhat Runtime Environment's members to the
// global scope, and execute the script.
const hre = require("hardhat");

async function main() {
  [owner, sender, recipient, par] = await ethers.getSigners()
        
  const Token = await ethers.getContractFactory('Token')
  token = await Token.deploy(
      'DigitalCoin',
      'OT'
      )

  let transaction2 = await token.connect(sender).mintToken(sender.address, 100)
  await transaction2.wait()
  let transaction3 = await token.connect(recipient).mintToken(recipient.address, 100)
  await transaction3.wait()
  let transaction4 = await token.connect(par).mintToken(par.address, 100)
  await transaction4.wait()
  
  console.log(owner.address)
  console.log(token.address)

  deployOcbcToken()

  console.log(`Finished.`)
}

async function deployOcbcToken() {

  const OcbcToken = await ethers.getContractFactory('OcbcToken')
  ocbcToken = await OcbcToken.deploy()
  await ocbcToken.deployed()
  console.log("OcbcToken deployed to:", ocbcToken.address)

}

// We recommend this pattern to be able to use async/await everywhere
// and properly handle errors.
main().catch((error) => {
  console.error(error);
  process.exitCode = 1;
});
